{include file="public/head" /}
<body>
{include file="public/menu" /}
<div class="member">
    <div class="wrap">
{include file="public/left" /}
        <div class="setting">
            <form id="pagemain" action="">
                <div class="head commonTab">
                    <div>
                        <a class="ac" href="{:url('Member/info')}">个人资料</a>
                        <a href="{:url('Member/safe')}">安全中心</a>
                        <a href="{:url('Member/card')}">银行卡</a>
                    </div>

                </div>
                <div class="middle">
                    <div class="right">
                        <h3><span></span>基本信息</h3>
                        <ul>
                            <li>
                                <div class="tip">头像</div>
                                <div class="info">
                                    <div class="userhead" id="tochangehead" style="cursor:pointer;background: url('{$member.head_thumb}') center no-repeat;background-size: cover"><span>修改头像</span></div>
                                </div>
                            </li>
                            <li>
                                <div class="tip">账户名</div>
                                <div class="info"><span  class="old-info">{:getXXtel($member.mobile)}</span></div>
                            </li>
                            <li>
                                <div class="tip">实名</div>
                                <div class="info"><span>{if $member.is_check}已认证{else}未认证{/if}</span></div>
                            </li>
                            <li>
                                <div class="tip"><span>性别</span></div>
                                <div class="info">
                                    {if $member.sex}{$member.sex}{/if}
                                </div>
                            </li>
							<li>
								<div class="tip">类型</div>
                                <div class="info"><span class="old-info">{$lookinfo.name}（{$lookinfo.create_time}）<a href="{:url('Member/lookinto')}">重新评估</a></div>
							</li>
                        </ul>
                    </div>
                </div>
            </form>
            <!--点击修改头像-->
            <div class="alert">
                <div class="mask">
                    <form action="{:url('Member/headimg')}" class="box" method="post" enctype="multipart/form-data">
                        <div class="headline">
                            <span class="fl">上传头像</span>
                            <span class="fr" id="close"></span>
                        </div>
                        <div class="add">
                            <div class="icon"></div>
                            <p>添加图片</p>
                            <p>只支持JPG、PNG、GIF，大小不超过2M</p>
                            <p>建议尺寸为240x240</p>
                            <input type="file" id="picture" name="photo">
                        </div>
                        <div class="show">
                            <div class="pic"><img id="picpreview" src="{$member.head_thumb}" alt=""></div>
                            <p>头像预览</p>
                        </div>
                        <div class="clear"></div>
                        <div class="btns">
                            <input type="submit" id="picUpload" value="确定">
                            <input type="reset" value="取消" id="cancle">
                        </div>
                    </form>
                </div>
            </div>
            <!--点击编辑-->
            <div class="edit">
                <form action="" onSubmit="return checkEdit()">
                    <h3>新增通讯地址</h3>
                    <div class="item">
                        <div class="label"><i>*</i>所在地区：</div>
                        <div class="input"><input type="text" id="area"></div>
                    </div>
                    <div class="item">
                        <div class="label"><i>*</i>详细地址：</div>
                        <div class="input"><textarea name="" id="address"  ></textarea></div>
                    </div>
                    <div class="item">
                        <div class="label">邮政编码：</div>
                        <div class="input"><input type="text"></div>
                    </div>
                    <div class="item">
                        <div class="label"><i>*</i>收货人：</div>
                        <div class="input"><input type="text" id="consignee"></div>
                    </div>
                    <div class="item">
                        <div class="label">手机号码：</div>
                        <div class="input"><input type="text"></div>
                    </div>
                   <input type="submit" value="保存">
                </form>
                <div class="editerr">请完善必填信息！</div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
</div>
{include file="public/foot" /}
</body>
{include file="public/load_bottom" /}
<script>
    $(function () {
        $('.sc').click(function () {
            $(this).parents('tr').remove()
        })
        $('.sex').click(function () {
            $(this).addClass('ac').siblings().removeClass('ac')
        })
        $('.change').click(function () {
            $(this).siblings('.old-info').hide()
            $(this).siblings('.changeinput').show()
        })
        $('.changeinput').blur(function () {
            var val = $(this).val()
            $(this).siblings('.old-info').text(val)
            $(this).siblings('.old-info').show()
            $(this).hide()
        })

        // 上传头像
        $("#picture").change(function () {
            var s = $('#picture').val();
            var start = s.indexOf(".") + 1;
            var name = s.substring(start, s.length).toLowerCase();
            if (name != "jpg" && name != "png" && name != "gif") {
                alert("图片格式必须为jpg、png、gif中的一种");
                $("#picUpload").attr("disabled", true);
                return;
            }
            if (this.files[0].size / 1024 / 1024 > 5) {
                alert("图片不能超过5M");
                $("#picUpload").attr("disabled", true);
                return;
            }
            var objUrl = getObjectURL(this.files[0]);
            if (objUrl) {
                $("#picpreview").attr("src", objUrl);
            }
            $("#picUpload").attr("disabled", false);
        });
        // 取消
        $('#cancle').click(function(){
            $("#picpreview").attr("src", '__static__/hry/images/userhead_03.png');
        })
//获得file按钮选取文件的路径
        function getObjectURL(file) {
            var url = null;
            if (window.createObjectURL != undefined) { // basic
                url = window.createObjectURL(file);
            } else if (window.URL != undefined) { // mozilla(firefox)
                url = window.URL.createObjectURL(file);
            } else if (window.webkitURL != undefined) { // webkit or chrome
                url = window.webkitURL.createObjectURL(file);
            }
            return url;
        }
        $('#close').click(function () {
            $('.alert').fadeOut(200)
        })
        $('#tochangehead').click(function () {
            $('.alert').fadeIn(200)
        })

        // 点击编辑资料
        $('.bj').click(function(){
            $('#pagemain').hide()
            $('.edit').show()
        })
    })
function checkEdit() {
    var area = $('#area').val()
    var address = $('#address').val()
    var consignee = $('#consignee').val()
    if(area==''||address==''||consignee==''){
        $('.editerr').fadeIn(300)
        setTimeout(function(){
            $('.editerr').fadeOut(300)
        },1000)
        return false
    }
}
</script>
</html>